home *** CD-ROM | disk | FTP | other *** search
/ Colorado Rockies 2000 / Colorado Rockies 2000 by US West.iso / mac / xtras / Beatnik Xtra Lite / Beatnik Behaviors LiteD7.cst / 00009_Script_PlayNote Lite Behavior < prev   
Text File  |  1998-10-22  |  7KB  |  142 lines

  1. -- PlayNote Lite, a Beatnik Behavior
  2. -- 9/1/98  by Paul Sebastien, pauls@sirius.com, http://www.bitstream.net/psykosonik
  3.  
  4. global notePlayer
  5.  
  6.  
  7.  
  8.  
  9.  
  10. property pWhichEvent
  11. property pWhichChannel
  12. property pWhichBank
  13. property pWhichProgram
  14. property pWhichNote
  15. property pWhichDuration
  16. property pWhichVelocity
  17.  
  18.  
  19.  
  20. on getPropertyDescriptionList
  21.   
  22.   --  initialize the Beatnik Xtra instance
  23.   --  NOTE: you may want to instantiate multiple instances like the one below, using different instance names each time, in order to play note events on multiple instances simultaneously, if that's what you need to do. You can copy and paste this initializing script below and just change 'notePlayer' to 'notePlayer2' and 'notePlayer3' and so on, for each instance, and then set the mouse event scripts or 'doIt' script to target these additional instances accordingly, depending on how many instances you need. 
  24.   
  25.   
  26.   
  27.   
  28.   
  29.   
  30.   put "------------------------------"
  31.   if ilk(notePlayer) = #instance then stop(notePlayer)
  32.   set notePlayer = VOID
  33.   set notePlayer = new(xtra "beatnik",TRUE)
  34.   set bankFileName = the moviePath & "patches.hsb"
  35.   put "notePlayer =" && notePlayer
  36.   put "Bank =" && bankFileName
  37.   put "SetSampleLibrary(notePlayer) = " & setsampleLibrary(notePlayer, bankFileName)
  38.   put "SetReady(notePlayer) = " & setReady(notePlayer)
  39.   put "isReady(notePlayer) = " & isReady(notePlayer)
  40.   if not(isReady(notePlayer)) then
  41.     alert "The Beatnik Xtra did not initialize, the Beatnik soundbank file 'patches.hsb' must be in the same folder as your current Director movie is in (or modify the path in the script). Also, make sure that the Xtra (BEATNIK.X32) is added to this movie."
  42.     exit
  43.   end if
  44.   --  finished initializing the Beatnik Xtra instance
  45.   
  46.   
  47.   
  48.   
  49.   
  50.   
  51.   
  52.   
  53.   
  54.   set d = [:]
  55.   
  56.   
  57.   addProp d, #pWhichEvent, [#default: "mouseDown", #format: #symbol, #range: [#mouseDown, #mouseUp, #mouseEnter, #mouseLeave, #mouseWithin,#enterFrame,#exitFrame], #comment: "Choose a trigger event:"]
  58.   addProp d, #pWhichChannel, [#default: 1, #format: #integer, #range: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16], #comment: "Choose a MIDI channel:"]
  59.   addProp d, #pWhichBank, [#default: 0, #format: #integer, #range: [0,1,2], #comment: "Choose a Beatnik bank number (0-2):"]
  60.   addProp d, #pWhichProgram, [#default: 1, #format: #integer, #comment: "Enter a program/instrument number (0-127):"]
  61.   addProp d, #pWhichNote, [#default: 60, #format: #integer, #comment: "Enter a note number:"]
  62.   addProp d, #pWhichVelocity, [#default: 127, #format: #integer, #comment: "Enter a velocity (0-127):"]
  63.   addProp d, #pWhichDuration, [#default: 1000, #format: #integer, #comment: "Enter a duration in milliseconds (1000 = 1 second):"]
  64.   
  65.   
  66.   return d
  67. end
  68.  
  69.  
  70.  
  71. on doIt me
  72.   global notePlayer
  73.   playNote(notePlayer, pWhichChannel, pWhichBank, pWhichProgram, pWhichNote, pWhichVelocity, pWhichDuration)
  74.   
  75.   
  76. end
  77.  
  78.  
  79.  
  80. on mouseDown me
  81.   if the pWhichEvent of me = #mouseDown then doIt me
  82.   
  83. end
  84.  
  85.  
  86. on mouseUp me
  87.   if the pWhichEvent of me = #mouseUp then doIt me
  88.   
  89.   
  90.   
  91. end
  92.  
  93.  
  94. on mouseEnter me
  95.   if the pWhichEvent of me = #mouseEnter then doIt me
  96.   
  97. end
  98.  
  99.  
  100. on mouseLeave me
  101.   if the pWhichEvent of me = #mouseLeave then doIt me
  102.   
  103. end
  104.  
  105. on mouseWithin me
  106.   if the pWhichEvent of me = #mouseWithin then doIt me
  107.   
  108. end
  109.  
  110.  
  111. on enterFrame me
  112.   if the pWhichEvent of me = #enterFrame then doIt me
  113.   
  114. end
  115.  
  116. on exitFrame me
  117.   if the pWhichEvent of me = #exitFrame then doIt me
  118.   
  119. end
  120.  
  121.  
  122.  
  123. on stopMovie
  124.   global notePlayer
  125.    stop(notePlayer)
  126.   closeBeatnik(notePlayer)
  127.   set notePlayer=VOID
  128.  
  129. end stopMovie
  130.  
  131.  
  132.  
  133.  
  134.  
  135. on getBehaviorDescription
  136.   
  137.   
  138.   set description = "PlAY NOTE LITE BEHAVIOR" && RETURN & "by Paul Sebastien pauls@sirius.com" && RETURN && RETURN & "This Beatnik Behavior allows you to play note events directly to the Headspace Audio Engine, through a Beatnik Xtra instance named 'notePlayer'. You can edit this behavior's script to choose a different instance name if necessary, or specify multiple instances." && RETURN && RETURN & "PARAMETERS:" && RETURN && RETURN & "ò Choose a MIDI channel:" && RETURN & "...Let you choose a MIDI channel for the note to be played on (1-16)." && RETURN && RETURN & "ò Choose a trigger event:" && RETURN & "...Lets you choose which Director event you want to trigger the note." && RETURN && RETURN & "ò Choose a Beatnik bank number:" && RETURN & "...Lets you specify which Beatnik bank to play the note event to, where 0 is the standard General MIDI bank, 1 is the Beatnik Extended Bank, and 2 is the user/custom bank which can contain custom samples." && RETURN && RETURN &"ò Enter a program/instrument number (0-127):" && RETURN & "...Lets you enter the instrument program number (0-127) for the sound to be played." && RETURN && RETURN &"ò Enter a note number:" && RETURN & "...Lets you enter the note number for the note you want to play (0-127)" && RETURN && RETURN &"ò Enter a velocity:" && RETURN & "...Lets you enter the velocity (0-127) for the note that you want to play." && RETURN && RETURN &"ò Enter a duration in milliseconds (1000 = 1 second):" && RETURN & "...Lets you enter a duration/length for the note to play before it stops." && RETURN && RETURN &"IMPORTANT:" && RETURN &&RETURN & "- This behavior requires that the Beatnik Xtra Lite is properly added to your Director project, and also, the Beatnik soundbank (patches.hsb) must be in the same directory as your Director project file, otherwise you should change the path to the soundbank in this behavior's script if the soundbank resides elsewhere." && RETURN && RETURN & "- If you want to use this behavior to play notes on multiple instances simultaneously, you should modify the Beatnik instance name used in this behavior's script so it is unique for each instance. Currently, the instance name used is 'notePlayer', so if you want to use multiple instances or instances named something other than 'notePlayer', you can modify the name in the script to 'notePlayer2' and so on, as needed, to create multiple separate instances that can have notes played through them." && RETURN &&RETURN & "For more information on instantiating the Beatnik Xtra Lite, refer to the documentation or other Beatnik Xtra sample movies." && RETURN && RETURN & "To upgrade to Beatnik Behaviors Pro, or for more information on Beatnik-related products and music files, visit the Headspace web site at:" && RETURN && RETURN & "http://www.headspace.com"
  139.   
  140.   return description
  141. end
  142.